﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void шрифтToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fontDialog1.ShowColor = true; 
            if (fontDialog1.ShowDialog() == DialogResult.OK)   
            {
                richTextBox1.SelectionFont = fontDialog1.Font;   
                richTextBox1.SelectionColor = fontDialog1.Color; 
            }

        }

        private void фонToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                richTextBox1.SelectionBackColor = colorDialog1.Color;
            } 

        }

        private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear(); 
        }

        private void сохронитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            saveFileDialog1.AddExtension = true; 
            saveFileDialog1.Filter = "Формат RTF|*.rtf|Неформатированный текст|*.txt";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                richTextBox1.SaveFile(saveFileDialog1.FileName);
            } 

        }

        private void выходToolStripMenuItem_Click(object sender, EventArgs e)
        {
           Close();
        }

        private void открытьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.AddExtension = true;
            openFileDialog1.Filter = "Текстовые файлы |*.rtf;*.txt";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
           //  richTextBox1(openFileDialog1.FileName);  
            } 

        }

        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {

        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void фаилToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }
    }
}
